package bean;

import java.util.List;

import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import dao.AreaDAO;

import model.AreaInteresse;

/**
 * Session Bean implementation class AreaInteresseEJB
 */
@Stateless
@LocalBean
public class AreaInteresseEJB implements AreaInteresseEJBLocal {

	@PersistenceContext(unitName="galeradoconcurso")
	private EntityManager em;
	
    public AreaInteresseEJB() {
        // TODO Auto-generated constructor stub
    }

	@Override
	public void cadastrarArea(AreaInteresse area) {
		AreaDAO dao = new AreaDAO(em);
		dao.adicionarAreaDAO(area);
		
	}

	@Override
	public void removerArea(AreaInteresse area) {
		AreaDAO dao = new AreaDAO(em);
		dao.remove(area);
	}

	@Override
	public List<AreaInteresse> listarArea() {
		AreaDAO dao = new AreaDAO(em);
		return dao.listar();
	}

}
